package com.wuliang.generate.bean.entities.datasource;

import com.google.gson.annotations.Expose;
import com.wuliang.generate.common.core.basic.BasicEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Lazy;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author 邬魉
 */
@Data
@Lazy
@Entity
@Builder
@Cacheable
@ApiModel("表")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "t_datasource_table", schema = "wuliang_generate_datasource")
public class DatasourceTable extends BasicEntity {

    @Expose
    @ApiModelProperty(name = "schemaId", value = "归属于哪个数据库", dataType = "int")
    @Column(name = "schema_id", columnDefinition = "int unsigned comment '归属于哪个数据库'")
    private Integer schemaId;

    @Expose
    @ApiModelProperty(name = "tableName", value = "表名", dataType = "string")
    @Column(name = "table_name", columnDefinition = "varchar(255) null comment '表名'")
    private String tableName;

    @Expose
    @Builder.Default
    @ApiModelProperty(name = "tableCharter", value = "表编码", dataType = "string")
    @Column(name = "table_charter", columnDefinition = "varchar(255) default 'utf8' comment '表编码'")
    private String tableCharter = "utf8";

    @Expose
    @Builder.Default
    @ApiModelProperty(name = "tableCollate", value = "编码引擎", dataType = "string")
    @Column(name = "table_collate", columnDefinition = "varchar(255) default 'utf8_bin' comment '编码引擎'")
    private String tableCollate = "utf8_bin";

    @Expose
    @Builder.Default
    @ApiModelProperty(name = "tableEngine", value = "表引擎", dataType = "string")
    @Column(name = "table_engine", columnDefinition = "varchar(255) default 'InnoDB' comment '表引擎'")
    private String tableEngine = "InnoDB";

    @Expose
    @ApiModelProperty(name = "tableComment", value = "表注释", dataType = "string")
    @Column(name = "table_comment", columnDefinition = "varchar(255) default '' comment '表注释'")
    private String tableComment;

}
